//两数相加

class Solution {
public:
    ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
        ListNode* head = new ListNode(0);
        ListNode* cur = head;
        int t = 0;
        while(l1 || l2 || t)
        {
            if(l1)
            {
                t += l1->val;
                l1 = l1->next;
            }
            if(l2)
            {
                t += l2->val;
                l2 = l2->next;
            }
            cur->next = new ListNode(t % 10);
            cur = cur->next;
            t /= 10;
        }
        return head->next;
    }
};


